than nay native system would place them.
Signed-off-by: Keir Fraser <keir@xensource.com>
#pragma pack ()
-#define ACPI_PHYSICAL_ADDRESS 0xEA000
-
int acpi_build_tables(uint8_t *);
#endif /* _ACPI_2_0_H_ */
#define ROMBIOS_MAXOFFSET 0x0000FFFF
#define ROMBIOS_END (ROMBIOS_BEGIN + ROMBIOS_SIZE)
+/* Memory map. */
+#define HYPERCALL_PHYSICAL_ADDRESS 0x00080000
+#define VGABIOS_PHYSICAL_ADDRESS 0x000C0000
+#define ETHERBOOT_PHYSICAL_ADDRESS 0x000C8000
+#define VMXASSIST_PHYSICAL_ADDRESS 0x000D0000
+#define SMBIOS_PHYSICAL_ADDRESS 0x000E9000
+#define SMBIOS_MAXIMUM_SIZE 0x00001000
+#define ACPI_PHYSICAL_ADDRESS 0x000EA000
+#define ROMBIOS_PHYSICAL_ADDRESS 0x000F0000
#endif /* __HVMLOADER_CONFIG_H__ */
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307 USA.
*/
+
#include "roms.h"
-#include "acpi/acpi2_0.h" /* for ACPI_PHYSICAL_ADDRESS */
+#include "acpi/acpi2_0.h"
#include "hypercall.h"
#include "util.h"
-#include "smbios.h"
#include "config.h"
#include "apic_regs.h"
#include "pci_regs.h"
#include <xen/version.h>
#include <xen/hvm/params.h>
-/* memory map */
-#define HYPERCALL_PHYSICAL_ADDRESS 0x00080000
-#define VGABIOS_PHYSICAL_ADDRESS 0x000C0000
-#define ETHERBOOT_PHYSICAL_ADDRESS 0x000C8000
-#define VMXASSIST_PHYSICAL_ADDRESS 0x000D0000
-#define ROMBIOS_PHYSICAL_ADDRESS 0x000F0000
-
asm(
" .text \n"
" .globl _start \n"
"stack_top: \n"
);
-extern void create_mp_tables(void);
+void create_mp_tables(void);
+int hvm_write_smbios_tables(void);
static int
cirrus_check(void)
int main(void)
{
- int acpi_sz;
+ int acpi_sz = 0, vgabios_sz = 0, etherboot_sz = 0, rombios_sz, smbios_sz;
printf("HVM Loader\n");
init_hypercalls();
printf("Writing SMBIOS tables ...\n");
- hvm_write_smbios_tables();
+ smbios_sz = hvm_write_smbios_tables();
printf("Loading ROMBIOS ...\n");
- memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, sizeof(rombios));
+ rombios_sz = sizeof(rombios);
+ if ( rombios_sz > 0x10000 )
+ rombios_sz = 0x10000;
+ memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, rombios_sz);
highbios_setup();
apic_setup();
printf("Loading Cirrus VGABIOS ...\n");
memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
+ vgabios_sz = sizeof(vgabios_cirrusvga);
}
else
{
printf("Loading Standard VGABIOS ...\n");
memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
vgabios_stdvga, sizeof(vgabios_stdvga));
+ vgabios_sz = sizeof(vgabios_stdvga);
}
if ( must_load_nic() )
printf("Loading ETHERBOOT ...\n");
memcpy((void *)ETHERBOOT_PHYSICAL_ADDRESS,
etherboot, sizeof(etherboot));
+ etherboot_sz = sizeof(etherboot);
}
- if ( get_acpi_enabled() != 0 )
+ if ( get_acpi_enabled() )
{
printf("Loading ACPI ...\n");
acpi_sz = acpi_build_tables((uint8_t *)ACPI_PHYSICAL_ADDRESS);
cmos_write_memory_size();
+ printf("BIOS map:\n");
+ if ( vgabios_sz )
+ printf(" %05x-%05x: VGA BIOS\n",
+ VGABIOS_PHYSICAL_ADDRESS,
+ VGABIOS_PHYSICAL_ADDRESS + vgabios_sz - 1);
+ if ( etherboot_sz )
+ printf(" %05x-%05x: Etherboot ROM\n",
+ ETHERBOOT_PHYSICAL_ADDRESS,
+ ETHERBOOT_PHYSICAL_ADDRESS + etherboot_sz - 1);
+ if ( !check_amd() )
+ printf(" %05x-%05x: VMXAssist\n",
+ VMXASSIST_PHYSICAL_ADDRESS,
+ VMXASSIST_PHYSICAL_ADDRESS + sizeof(vmxassist) - 1);
+ if ( smbios_sz )
+ printf(" %05x-%05x: SMBIOS tables\n",
+ SMBIOS_PHYSICAL_ADDRESS,
+ SMBIOS_PHYSICAL_ADDRESS + smbios_sz - 1);
+ if ( acpi_sz )
+ printf(" %05x-%05x: ACPI tables\n",
+ ACPI_PHYSICAL_ADDRESS,
+ ACPI_PHYSICAL_ADDRESS + acpi_sz - 1);
+ if ( rombios_sz )
+ printf(" %05x-%05x: Main BIOS\n",
+ ROMBIOS_PHYSICAL_ADDRESS,
+ ROMBIOS_PHYSICAL_ADDRESS + rombios_sz - 1);
+
if ( !check_amd() )
{
printf("Loading VMXAssist ...\n");
#ifndef __HVMLOADER_HYPERCALL_H__
#define __HVMLOADER_HYPERCALL_H__
+#include <stdint.h>
#include <xen/xen.h>
+#include "config.h"
+
+#define __STR(...) #__VA_ARGS__
+#define STR(...) __STR(__VA_ARGS__)
/*
* NB. Hypercall address needs to be relative to a linkage symbol for
* some version of ld to relocate the relative calls properly.
- * Keep this in sync with HYPERCALL_PHYSICAL_ADDRESS in hvmloader.c!
*/
-#define hypercall_pa "_start - 0x80000"
-
-#define __STR(x) #x
-#define STR(x) __STR(x)
+#define hypercall_pa "_start - " STR(HYPERCALL_PHYSICAL_ADDRESS)
#define _hypercall0(type, name) \
({ \
#include <stdint.h>
#include <xen/version.h>
-#include "smbios.h"
#include "smbios_types.h"
#include "util.h"
#include "hypercall.h"
-static size_t
+static int
write_smbios_tables(void *start,
uint32_t vcpus, uint64_t memsize,
uint8_t uuid[16], char *xen_version,
strncpy(buf, "unknown", len);
}
-static size_t
+static int
write_smbios_tables(void *start,
uint32_t vcpus, uint64_t memsize,
uint8_t uuid[16], char *xen_version,
SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
nr_structs);
- return (size_t)((char *)p - (char *)start);
+ return ((char *)p - (char *)start);
}
/* Calculate how much pseudo-physical memory (in MB) is allocated to us. */
return (memsize + (1 << 20) - 1) >> 20;
}
-void
+int
hvm_write_smbios_tables(void)
{
uint8_t uuid[16]; /* ** This will break if xen_domain_handle_t is
get_vcpu_nr(), get_memsize(),
uuid, xen_version_str,
xen_major_version, xen_minor_version);
- if ( len > SMBIOS_SIZE_LIMIT )
+ if ( len > SMBIOS_MAXIMUM_SIZE )
goto error_out;
/* Okay, not too large: copy out of scratch to final location. */
memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len);
- return;
+ return len;
error_out:
printf("Could not write SMBIOS tables, error in hvmloader.c:"
"hvm_write_smbios_tables()\n");
+ return 0;
}
+++ /dev/null
-/*
- * smbios.h - interface for Xen HVM SMBIOS generation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright (C) IBM Corporation, 2006
- *
- * Authors: Andrew D. Ball <aball@us.ibm.com>
- */
-
-#ifndef SMBIOS_H
-#define SMBIOS_H
-
-#include <stdint.h>
-#include <stdlib.h>
-
-/* These constants must agree with the ACPI e820 memory map as defined
- in tools/libxc/xc_hvm_build.c and the address the ROMBIOS pulls the
- SMBIOS entry point from in the smbios_init subroutine.
- */
-#define SMBIOS_PHYSICAL_ADDRESS 0x9f000
-#define SMBIOS_SIZE_LIMIT 0x800
-
-void hvm_write_smbios_tables(void);
-
-#endif /* SMBIOS_H */
* Place - Suite 330, Boston, MA 02111-1307 USA.
*/
-#include "acpi/acpi2_0.h" /* for ACPI_PHYSICAL_ADDRESS */
#include "util.h"
#include "config.h"
#include <stdint.h>
#define __HVMLOADER_UTIL_H__
#include <stdarg.h>
+#include <stdint.h>
#undef offsetof
#define offsetof(t, m) ((unsigned long)&((t *)0)->m)
// ROM BIOS for use with Bochs/Plex x86 emulation environment
+#include "../hvmloader/config.h"
+
#define HVMASSIST
#undef HVMTEST
#ifdef HVMASSIST
-; Copy the SMBIOS entry point over from 0x9f000, where hvmloader left it.
+; Copy the SMBIOS entry point from where hvmloader left it.
; The entry point must be somewhere in 0xf0000-0xfffff on a 16-byte boundary,
-; but the tables themeselves can be elsewhere.
+; but the tables themselves can be elsewhere.
smbios_init:
push ax
push cx
mov ax, #0xf000
mov es, ax ; destination segment is 0xf0000
mov di, #smbios_entry_point ; destination offset
- mov ax, #0x9f00
- mov ds, ax ; source segment is 0x9f000
- mov si, #0x0000 ; source offset is 0
+ mov ax, #(SMBIOS_PHYSICAL_ADDRESS>>4)
+ mov ds, ax
+ mov si, #(SMBIOS_PHYSICAL_ADDRESS&15)
cld
rep
movsb
mem_size = HVM_BELOW_4G_RAM_END;
}
- /* 0x0-0x9F000: Ordinary RAM. */
+ /* 0x0-0x9FC00: Ordinary RAM. */
e820entry[nr_map].addr = 0x0;
- e820entry[nr_map].size = 0x9F000;
+ e820entry[nr_map].size = 0x9FC00;
e820entry[nr_map].type = E820_RAM;
nr_map++;
- /*
- * 0x9F000-0x9F800: SMBIOS tables.
- * 0x9FC00-0xA0000: Extended BIOS Data Area (EBDA).
- * TODO: SMBIOS tables should be moved higher (>=0xE0000).
- * They are unusually low in our memory map: could cause problems?
- */
- e820entry[nr_map].addr = 0x9F000;
- e820entry[nr_map].size = 0x1000;
+ /* 0x9FC00-0xA0000: Extended BIOS Data Area (EBDA). */
+ e820entry[nr_map].addr = 0x9FC00;
+ e820entry[nr_map].size = 0x400;
e820entry[nr_map].type = E820_RESERVED;
nr_map++;